<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>用款申请-详细</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/dist/plugins/webuploader-0.1.5/webuploader.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=f5a12a1d">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style type="text/css">
        .blockElement {
            position: fixed !important;
            top: 50% !important;
        }

        .user {
            height: 30px;
            line-height: 30px;
            max-height: 30px;
            float: left;
            text-align: left;
            min-width: 32px;
            padding-left: 1px;
            overflow: hidden;
            cursor: pointer;
        }

        .table-detail td.td-value2 {
            padding: 1px !important;
            text-align: left !important;
        }

        .pull-left {
            float: left;
            padding-left: 6px;
        }

        .td-value2 input {
            box-shadow: inset 1px 1px 4px #333;
            height: 100% !important;
            padding-left: 4px !important;
        }

        .td-value2 select {
            box-shadow: inset 1px 1px 4px #333;
            height: 100% !important;
            padding-left: 4px !important;
            color: #2a8cec;
        }

        .lineOne {
            text-align: left;
        }

        .td-value span.lineOne {
            overflow: hidden;
            text-overflow: ellipsis;
            color: black !important;
            /*display: -webkit-box;*/
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            max-height: 34px;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .user:hover {
            background-color: #cfd4d1;
        }

        .userbox .select.user {
            color: #fff;
            background-color: #045B9E;
        }

        .span-btn {
            position: absolute;
            left: 27px;
            margin-top: 0px;
            cursor: pointer;
        }

        /*.auditorName {*/
            /*text-align: left;*/
        /*}*/

        .payAuditorName{
            text-align: center;
        }

        .IcoNormal {
            float: left;
            border-bottom: 0px;
            border-left: 0px;
            background-color: transparent;
            width: 16px;
            height: 16px;
            vertical-align: middle;
            border-top: 0px;
            border-right: 0px;
            background-image: url(/dist/img/upload_normal.gif);
            background-repeat: no-repeat;
            float: left;
        }

        .progressobj {
            height: 20px;
        }

        .progressobj .delfile {
            float: left;
            margin-left: 10px;
        }

        .select {
            color: #fff;
            background-color: #045B9E;
        }

        td .sp-value {
            display: inline-block;
            padding-left: 6px;
            word-wrap: break-word;
        }

        td {
            color: #2a8cec;
        }

        td.td-title, td select, td .filename, td.td-module {
            color: black;
        }

        .table-detail-payee:nth-child(even) td.td-title {
            background-color: white;
        }

        .printDiv {
            display: none;
        }

        .printInput {
            width: 200px;
        }

        .printBtn {
            margin: 0 auto;
            display: block;
        }

        .webuploader-pick {
            background: url(/dist/img/fjT1.png) no-repeat 5px center;
            display: block;
            padding: 0 4px;
            height: 22px;
            line-height: 22px;
            padding-left: 15px;
            margin: 0 auto;
            width: 70px;
            margin-top: 2px;
            border-radius: 4px;
        }

        .webuploader-pick-hover {
            color: #fff !important;
            background: url(/dist/img/fjT2.png) no-repeat 5px center;
            background-color: #0F6099;

        }

        #divUploadedFiles {
            /*padding: 4px;*/
            padding-bottom: 0;
        }

        .jiaobiao3 {
            position: relative;
        }

        .jiaobiao3 i {
            display: block;
            width: 6px;
            height: 6px;
            background: url("/dist/img/newLog3.png");
            position: absolute;
            top: 0px;
            right: 0px;
        }

        .moreListData {
            position: absolute;
            top: 30px;
            z-index: 111;
            display: none;
        }

        .moreListData .item {
            width: 100%;
            height: 30px;
            line-height: 30px;
        }

        .moreListData .item span {
            margin-right: 5px;
        }

        .ui_main {
            vertical-align: top;
        }
    </style>
</head>
<body>
<div class="oaLoad">
    <div class="loadGif" id="areaProgress"></div>
</div>
<iframe id="ifAttach" style="display:none"></iframe>
<div class="layout" style="left:0px;top:0px;right:0px;bottom:0px;" id="app" v-cloak>
    <!--<h4 class="text-center">{{money.main.title}}</h4>-->

    <table class="title-table printDiv" border=0 cellSpacing=0 cellPadding=0>
        <tbody>
        <tr class="">
            <td style="text-align: left"><span class=titlePre>申请日期：</span><span class=contentPrefix>{{money.main.createTime}}</span>
            </td>
            <td style="text-align: right"><span class=titlePre>流水单号：</span><span
                    class=contentPrefix>{{money.main.seriesNumber}}</span></td>
        </tr>
        </tbody>
    </table>
    <div class="div-td-content-more"><i></i></div>
    <div class="center" style="overflow:auto;overflow-x:hidden;padding-left:8px;padding-right:8px;">
        <table class="table-detail">
            <tr class="no-print">
                <td colspan="6" class=" no-print td-module" style="background: yellow;">基本信息</td>
            </tr>
            <tr>
                <td style="width:145px;" class="td-title">申请人</td>
                <td style="width:145px;"><span
                        class="pull-left">{{money.main.createUserName}}</span>
                </td>
                <td style="width:145px;" class="td-title">申请时间</td>
                <td style="width:145px;"><span
                        class="pull-left">{{money.main.createTime}}</span>
                </td>

                <td style="width:145px;" class="td-title">用款部门</td>
                <td v-if="orgNameList.length>1&&pageType=='edit'&&payReturnStatus()" class="td-value2"
                    style="width:145px;">
                    <select v-if="orgNameList.length>1"
                            v-model="money.main.orgName" @click="getCompanyName">
                        <option v-for="item in orgNameList" v-bind:value="item.companyName+'-'+item.departName">
                            {{item.companyName}}-{{item.departName}}
                        </option>
                    </select>
                </td>
                <td v-else>
                    <span class="pull-left">{{money.main.orgName}}</span>
                </td>

            </tr>
            <tr>
                <td style="width:145px;" class="td-title">款项用途</td>
                <td style="width:145px;" class="td-value2">
                    <select v-if="pageType=='edit'&&payReturnStatus()" v-model="money.main.type"
                            @change="smallTypeChange()">
                        <option v-for="option in typeList" :value="option.name">{{option.name}}
                        </option>
                    </select>
                    <span v-else style="color:red;" class="pull-left">{{money.main.type}}</span>
                </td>
                <template v-if="money.main.type == '费用报销'">
                    <td class="td-title">发票提交方式</td>
                    <td class="td-value2">
                    <span v-if="pageType=='edit'">
                        <select v-model="money.main.submission">
                            <option value="邮寄">邮寄</option>
                            <option value="自带">自带</option>
                        </select>
                </span>
                        <span v-else class="sp-value">{{money.main.submission}}</span>
                    </td>
                </template>
                <template v-else>
                    <td class="td-value2" colspan="4"></td>
                </template>
            </tr>
            <!--<template v-if="money.main.haveRefund=='1'">
                <tr>
                    <td style="width:16%;" class="td-title">预计退款日期</td>
                    <td style="width:17%;" class="td-value2">
                        <input v-if="pageType=='edit'" type="text" v-model="money.main.estimatedReturnDate"
                               @focus="showDatePicker2($event)"/>
                        <span v-else class="pull-left">{{money.main.estimatedReturnDate}}</span>
                    </td>
                    <td style="width:16%;" class="td-title">预计退款金额</td>
                    <td style="width:17%;" class="td-value2"><input v-if="pageType=='edit'" type="text"
                                                                    @blur="strFormat($event.target,'money.main.estimatedReturnMoney')"
                                                                    @focus="strFormatF($event.target,'money.main.estimatedReturnMoney')"
                                                                    v-onedate="fmoney(money.main.estimatedReturnMoney)"/>
                        <span v-else class="pull-left">{{fmoney(money.main.estimatedReturnMoney)}}</span>
                        </span>
                        <span style="color: #2a8cec;position:absolute;left:105px;top: 1px;">元</span>
                    </td>
                    <td style="width:16%;" class="td-title">跟踪人</td>
                    <td style="width:17%;" class="td-value2"><input v-if="pageType=='edit'" type="text"
                                                                    class="returnPayee"
                                                                    v-model="money.main.returnPayeeName"
                                                                    @click="cilckInitAutoComplete()"/>
                        <span v-else class="pull-left">{{money.main.returnPayeeName}}</span>
                    </td>
                </tr>
            </template>-->

            <tr>
                <td class="td-title">用款事由</td>
                <td colspan="5"
                    style="text-align:left;line-height:20px;min-height:56px !important;height:56px;"
                    class="td-value2 moreList" data-table="t_apl_money_main"
                    data-column="description" data-type='1'>
                    <textarea v-if="pageType=='edit'&&payReturnStatus()" type="text"
                              v-model="money.main.description"></textarea>
                    <span v-else class="sp-value">{{money.main.description}}</span>
                </td>
            </tr>
            <tr>
                <td class="td-title">用款金额(合计)</td>
                <td colspan="5" style="text-align: left;" class="moreList"
                    data-table="t_apl_money_main"
                    data-column="price" data-type='1'>
                    <span class="sp-value">{{price?"¥"+price:"系统自动计算"}}{{priceChinese?"("+priceChinese+")":""}}</span>
                </td>

            </tr>
        </table>
        <!--收款部分-->
        <table class="table-detail table-detail-payee" style="border-top-width:0px;"
               v-for="(item,i) in money.payees">
            <tr>
                <td class="td-title" style="width:145px;">
                    <span v-if="pageType=='edit'&&payReturnStatus()" class="span-btn" style="font-size:20px;"
                          @click="addItem('payees','Payee')"> + </span>

                    收款人{{i+1}}
                    <span v-if="pageType=='edit'&&payReturnStatus()" class="span-btn" style="font-size:20px;left: 100px"
                          @click="delItem('payees',i,'收款人')"> - </span>

                </td>
                <td style="width:290px;" class="td-value2 moreList" data-table="t_apl_money_payee"
                    data-column="FK_MONEY_ID"
                    :data-mid="id" data-columnName="PAYEE_NAME" data-type='2'>
                    <input @change="payeeFocus(i)" v-if="pageType=='edit'&&payReturnStatus()" class="payeeName"
                           type="text"
                           v-model="item.payeeName"/>
                    <span v-else class="pull-left">{{item.payeeName}}</span>
                </td>
                <td class="td-title" style="width:145px;">付款方式</td>
                <td class="td-value2 moreList" data-table="t_apl_money_payee"
                    data-column="FK_MONEY_ID"
                    :data-mid="id" data-columnName="PAYEE_TYPE" data-type='2'>
                    <select v-if="pageType=='edit'&&payReturnStatus()" v-model="item.payeeType">
                        <option v-for="option in payList" :value="option.name">{{option.name}}
                        </option>
                    </select>
                    <span v-else class="pull-left">{{item.payeeType}}</span>
                </td>
            </tr>
            <tr>
                <td class="td-title">用款金额</td>
                <td :style="pageType=='edit'&&payReturnStatus()?'':'text-align:left;'"
                    class="td-value2 moreList"
                    data-table="t_apl_money_payee"
                    data-column="FK_MONEY_ID"
                    :data-mid="id" data-columnName="PAYEE_MONEY" data-type='2'>
                    <input v-if="pageType=='edit'&&payReturnStatus()" type="number" v-model="item.payeeMoney"
                           @keyup="convertToChinese(item)" min="0" max="999999999"/>
                    <span class="sp-value" v-else>{{item.payeeMoney?(item.payeeMoney.toFixed(2)):""}}</span>
                </td>
                <td colspan="2" style="text-align:center;text-indent:6px;">
                    <span>{{item.payeeMoneyChinese}}</span>
                </td>
            </tr>
            <tr>
                <td class="td-title">冲账方式</td>
                <td class="td-value2 moreList" data-table="t_apl_money_payee"
                    data-column="FK_MONEY_ID"
                    :data-mid="id" data-columnName="OFF_THE_WAY" data-type='2'>
                    <select v-if="pageType=='edit'&&payReturnStatus()" v-model="item.offTheWay">
                        <option v-for="option in offTheWayList" :value="option.name">
                            {{option.name}}
                        </option>
                    </select>
                    <span v-else class="sp-value">{{item.offTheWay}}</span>
                </td>
                <td class="td-title">预计冲帐时间</td>

                <td class="td-value2 moreList" data-table="t_apl_money_payee"
                    data-column="FK_MONEY_ID"
                    :data-mid="id" data-columnName="OFF_TIME" data-type='2'>
                    <input v-if="pageType=='edit'&&payReturnStatus()" type="text" v-model="item.offTime"
                           @focus="showDatePicker($event,item)"/>
                    <span v-else class="sp-value">{{item.offTime}}</span>
                </td>
            </tr>
            <template v-if="item.payeeType != '冲账'">
                <tr>
                    <td class="td-title">开户银行</td>
                    <td class="td-value2 moreList" data-table="t_apl_money_payee"
                        data-column="FK_MONEY_ID"
                        :data-mid="id" data-columnName="BANK_NAME" data-type='2'>
                        <input v-if="pageType=='edit'" type="text" v-model="item.bankName"/>
                        <span v-else class="sp-value">{{item.bankName}}</span>
                    </td>
                    <td class="td-title">卡号</td>
                    <td class="td-value2 moreList" data-table="t_apl_money_payee"
                        data-column="FK_MONEY_ID"
                        :data-mid="id" data-columnName="BANK_CARD_NUMBER" data-type='2'>
                        <input v-if="pageType=='edit'" type="text" v-model="item.bankCardNumber"/>
                        <span v-else class="sp-value">{{item.bankCardNumber}}</span>
                    </td>
                </tr>
            </template>
        </table>
        <table class="table-detail no-print" style="border-top-width:0px;">
            <tr>
                <td class="td-title" style="width:145px;">是否紧急</td>
                <td style="text-align:center;width:290px;" class="td-value2">
                    <span v-if="pageType=='edit'&&payReturnStatus()">
                        <select v-model="money.main.urgentFlag">
                            <option value="1">是</option>
                            <option value="0">否</option>
                        </select>
                </span>
                    <span v-else class="sp-value">{{money.main.urgentFlag=='1'?'是':'否'}}</span>
                </td>
                <td class="td-title" style="width:145px;"></td>
                <td class="td-value2"></td>
                <!--<td class="td-title" style="width:145px;background-color:white;">是否有退款</td>-->
                <!--<td class="td-value2 ">-->
                    <!--<select v-model="money.main.haveRefund" v-if="pageType=='edit'&&payReturnStatus()">-->
                        <!--<option value="0">否-->
                        <!--</option>-->
                        <!--<option value="1">是-->
                        <!--</option>-->
                    <!--</select>-->
                    <!--<span v-else class="pull-left">{{money.main.haveRefund=='1'?'是':'否'}}</span>-->
                <!--</td>-->
            </tr>
            <!--<template v-if="money.main.haveRefund==='1'">-->
                <!--<tr>-->
                    <!--<td style="width:145px;" class="td-title">预计退款日期</td>-->
                    <!--<td style="text-align:center;width:290px;" class="td-value2 moreList"-->
                        <!--data-table="t_apl_money_main"-->
                        <!--data-column="estimatedReturnDate" data-type='1'>-->
                        <!--<input v-if="pageType=='edit'&&payReturnStatus()" type="text"-->
                               <!--v-model="money.main.estimatedReturnDate"-->
                               <!--@focus="showDatePicker2($event)"/>-->
                        <!--<span v-else class="pull-left">{{money.main.estimatedReturnDate}}</span>-->
                    <!--</td>-->
                    <!--<td style="width:145px;background-color:white;" class="td-title">预计退款金额(元)</td>-->
                    <!--<td style="text-align:center;border-right-width:0px;width:290px;"-->
                        <!--class="td-value2 moreList"-->
                        <!--data-table="t_apl_money_main"-->
                        <!--data-column="estimatedReturnMoney" data-type='1'><input-->
                            <!--v-if="pageType=='edit'&&payReturnStatus()" type="text"-->
                            <!--@blur="strFormat($event.target,'money.main.estimatedReturnMoney')"-->
                            <!--@focus="strFormatF($event.target,'money.main.estimatedReturnMoney')"-->
                            <!--v-onedate="fmoney(money.main.estimatedReturnMoney)"/>-->
                        <!--<span v-else-->
                              <!--class="pull-left">{{fmoney(money.main.estimatedReturnMoney)}}</span>-->
                        <!--</span>-->
                        <!--&lt;!&ndash;<span style="color: #2a8cec;position:absolute;left:105px;top: 1px;">元</span>&ndash;&gt;-->
                    <!--</td>-->

                <!--</tr>-->
                <!--&lt;!&ndash;<tr>-->
                    <!--<td style="width:16%;" class="td-title">跟踪人</td>-->
                    <!--<td style="text-align:center;border-right-width:0px;width:33%;" class="td-value2"><input v-if="pageType=='edit'" type="text"-->
                                                                    <!--class="returnPayee"-->
                                                                    <!--v-model="money.main.returnPayeeName"-->
                                                                    <!--@click="cilckInitAutoComplete()"/>-->
                        <!--<span v-else class="pull-left">{{money.main.returnPayeeName}}</span>-->
                    <!--</td>-->
                    <!--<td colspan="2"></td>-->
                <!--</tr>&ndash;&gt;-->
            <!--</template>-->
            <tr>
                <td class="td-title" style="width:145px;">附件</td>
                <td style="width:290px;" :colspan="pageType=='edit'&&payReturnStatus()?1:3">
                    <div id="divUploadedFiles">
                        <div v-for="(attach,i) in money.attaches" class="fj-tanzhongStyle">
                            <!--<input type="button" class="IcoNormal" style="float:left;"/>-->
                            <b :class="fjStyle(attach.name)"></b>
                            <div class="name" v-if="attach.name" :title="attach.name">
                                {{attach.name}}
                            </div>
                            <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                 v-on:click="download(attach.url,attach.name)">下载</a>
                            </div>
                            <div class="del" v-if="pageType=='edit'&&payReturnStatus()"><a href="javascript:void(0)"
                                                                                           class="nui-txt-link"
                                                                                           v-on:click="deleteFile(i)">删除</a>
                            </div>
                            <!--<div class="info"><span class="nui-txt-suc">上传完成</span></div>-->
                        </div>
                    </div>
                    <div v-if="money.attaches.length==0&&pageType!='edit'" style="text-align: left;"><span
                            class="sp-value">无</span></div>
                </td>
                <td v-if="pageType=='edit'&&payReturnStatus()" colspan="2">
                    <div id="divUpload">
                        添加附件
                    </div>
                </td>
            </tr>

        </table>
        <table class="table-detail no-print" style="border-top-width:0px;table-layout: auto;">
            <tr>
                <td class=" td-module" colspan="5" style="background: yellow;">审批进度</td>
            </tr>
            <tr>
                <td class="td-title" style="width:145px;">审核顺序</td>
                <td class="td-title" style="width:145px;">审核人员</td>
                <td class="td-title" style="width:145px;">审核状态</td>
                <td class="td-title" style="width:145px;">审核时间</td>
                <td class="td-title">审核意见</td>
            </tr>
            <tr v-for="(item,i) in money.auditors">
                <td>

                        <span style="font-size:20px;" v-if="pageType=='edit'&&payReturnStatus()" class="span-btn"
                              @click="addItem('auditors','Audit')"> + </span>


                    <span>第{{i+1}}审核人</span>

                    <span style="font-size:20px;left: 104px;" v-if="pageType=='edit'&&payReturnStatus()"
                          class="span-btn"
                          @click="delItem('auditors',i,'审核人')"> - </span>

                </td>
                <td style="text-align: left;">
                    <input v-if="pageType=='edit'&&payReturnStatus()" class="auditorName" type="text"
                           :value="item.auditorName" :idx="i"/>
                    <span style="padding-left: 6px;" v-else>{{item.auditorName}}</span>
                </td>
                <td>
                    <span v-if="item.auditFlag==0" style="color:red;">{{convertAuditFlagToName(item.auditFlag)}}</span>
                    <span v-else>{{convertAuditFlagToName(item.auditFlag)}}</span>
                </td>
                <td>{{item.auditTime}}</td>
                <td><input type="text" v-model="item.auditAdvise"/></td>
            </tr>
        </table>
        <!--抄送人 和  付款人-->
        <table class="table-detail" style="border-top-width:0px;margin-bottom:20px;">
            <tr class="printDiv">
                <td class="td-title " style="width:145px;">审核人</td>
                <td class="" colspan="5">
                    <div v-for="(item,i) in money.auditors" class="user">{{item.auditorName}};
                    </div>
                </td>
            </tr>
            <tr>
                <td class="td-title" style="width:145px;">抄送人</td>
                <td colspan="5">
                    <div id="user" style="padding-left:6px;"
                         v-on:click.stop="inputFocus('txtCopier')">
                        <div v-for="(user,i) in money.copiers" class="user"
                             v-bind:class="{ select: copierSelectedIdx == i }"
                             v-on:click="selectUser(i,'copierSelectedIdx')">{{user.copyPersonName}};
                        </div>
                        <input v-if="pageType=='edit'&&payReturnStatus()" class="pull-left copier" id="txtCopier"
                               style="width:100px"
                               type="text" @keyup.delete="deleteUser"/>
                    </div>
                </td>
            </tr>
            <tr v-if="money.main.copierReturnReason">
                <td class="td-title" style="width:145px;">抄送人驳回原因</td>
                <td colspan="5" style="text-align:left;">
                    <span class="sp-value">{{money.main.copierReturnReason}}</span>
                </td>
            </tr>
        </table>

        <!--财务经理 待申请付款-->
        <template v-if="(money.main.auditFlag == '1' && pageType!='browser') || money.main.auditFlag == '3'|| money.main.auditFlag == '4'|| money.main.auditFlag == '5'|| money.main.auditFlag == '6'">
            <table  class="table-detail no-print" style="border-top-width:0px;margin-bottom:20px;table-layout: auto;">
                <tr>
                    <td class=" td-module" colspan="5" style="background: yellow;">付款审批进度</td>
                </tr>
                <tr>
                    <td class="td-title" style="width:145px;">审核顺序</td>
                    <td class="td-title" style="width:145px;">审核人员</td>
                    <td class="td-title" style="width:145px;">审核状态</td>
                    <td class="td-title" style="width:145px;">审核时间</td>
                    <td class="td-title">审核意见</td>
                </tr>
                <tr v-for="(item,i) in money.auditList">
                    <td>
                    <span style="font-size:20px;" v-if="pageType=='waitPay'" class="span-btn"
                          @click="addItem('auditList','PayAudit')"> + </span>
                        <span>第{{i+1}}审核人</span>
                        <span style="font-size:20px;left: 104px;" v-if="pageType=='waitPay'" class="span-btn"
                              @click="delItem('auditList',i,'审核人')"> - </span>
                    </td>
                    <td style="text-align: left;">
                        <input v-if="pageType=='waitPay'" class="payAuditorName" type="text"
                               :value="item.auditorName" :idx="i"/>
                        <span style="padding-left: 6px;" v-else>{{item.auditorName}}-{{item.roleName}}</span>
                    </td>
                    <td>
                        <span v-if="item.auditFlag==3" style="color:red;">{{convertAuditFlagToName(item.auditFlag)}}</span>
                        <span v-else>{{convertAuditFlagToName(item.auditFlag)}}</span>
                    </td>
                    <td>{{item.auditTime}}</td>
                    <td><input type="text" v-model="item.auditAdvise"/></td>
                </tr>
            </table>
        </template>


        <table class="table-detail" style="border-top-width:0px;margin-bottom:20px;">
            <tr class="no-print">
                <td colspan="6" class=" td-module" style="background: yellow;">付款信息</td>
            </tr>
            <tr class="no-print">
                <td class="td-title" style="width:145px;">付款人员</td>
                <td style="width:145px;" class="moreList" data-table="t_apl_money_main"
                    data-column="payUserName" data-type='1'><input type="text"
                                                                   v-model="money.main.payUserName"/>
                </td>
                <td class="td-title" style="width:145px;">付款状态</td>
                <td style="width:145px;" class="sp-value "><span
                        class="pull-left">{{money.main.auditFlag=='6'?'已付款':'未付款'}}</span>
                </td>
                <td class="td-title " style="width:145px;">付款时间</td>
                <td><input type="text" v-model="money.main.payDate"/></td>
            </tr>
            <tr class="no-print">
                <td class="td-title">说明</td>
                <td colspan="5" class="moreList" data-table="t_apl_money_main"
                    data-column="remark" data-type='1'><textarea type="text"
                                                                 v-model="money.main.remark"></textarea>
                </td>
            </tr>
            <tr class="no-print">
                <td class="td-title">付款审核备注</td>
                <td colspan="5" class="moreList" data-table="t_apl_money_main"
                    data-column="payRemark" data-type='1'>
                    <textarea type="text" v-model="money.main.payRemark"></textarea>
                </td>
            </tr>
            <tr v-if="money.main.payReturnUserId" class="no-print">
                <td class="td-title">付款驳回人</td>
                <td colspan="5"><span>{{money.main.payReturnUserName}}</span></td>
            </tr>
            <tr v-if="money.main.payReturnUserId" class="no-print">
                <td class="td-title">付款原因</td>
                <td colspan="5"><span>{{money.main.payReturnReasonType}}：{{money.main.payReturnReasonDesc}}</span>
                </td>
            </tr>
            <template v-if="historys.length!=0">
                <tr class="no-print">
                    <td colspan="6" class=" td-module" style="background: yellow;">历史驳回记录</td>
                </tr>
                <tr class="no-print" v-for="(item,i) in historys">
                    <td class="td-title">驳回人员</td>
                    <td><span class="pull-left">{{item.auditorName}}</span></td>
                    <td class="td-title">驳回时间</td>
                    <td><span class="pull-left">{{item.auditTime}}</span></td>
                    <td class="td-title">驳回原因</td>
                    <td class="lineOne"><span>{{item.auditAdvise}}</span></td>
                </tr>
            </template>
        </table>
    </div>
    <div class="south no-print" style="height:50px;line-height:50px;text-align:center;">
        <input type="button" style="margin-left:20px;" v-if="pageType=='edit'&&payReturnStatus()&&money.main.auditFlag!='1'"
               value="保存草稿" class="btn oaBtn btn-sm" @click="save(-1)"/>
        <input type="button" style="margin-left:20px;" v-if="pageType=='edit'&&money.main.auditFlag!='1'"
               value="提交申请" class="btn oaBtn btn-sm" @click="save(0)">
        <input type="button" style="margin-left:20px;"
               v-if="pageType=='applyAudit' && money.main.auditFlag=='0' && money.main.currentAuditorId==currentUser.id"
               value="用款通过" class="btn oaBtn btn-sm" @click="applyAudit('1')">
        <input type="button" style="margin-left:20px;"
               v-if="isShowAuditReturnBtn || pageType=='applyAudit' && money.main.auditFlag=='0' && money.main.currentAuditorId==currentUser.id"
               value="用款驳回" class="btn oaBtn btn-sm" @click="applyAudit('2')">

        <!--待付款审核 操作按钮-->
        <!--<input type="button" style="margin-left:20px;" v-if="pageType=='waitPay'&&money.main.auditFlag=='1'"-->
               <!--value="保存草稿" class="btn oaBtn btn-sm" @click="savePayAuditors(-1)"/>-->
        <!--<input type="button" style="margin-left:20px;" v-if="pageType=='waitPay'&&money.main.auditFlag=='1'"-->
               <!--value="提交申请" class="btn oaBtn btn-sm" @click="savePayAuditors(3)">-->
        <input type="button" style="margin-left:20px;"
               v-if="pageType=='payAudit' && money.main.auditFlag=='3' && money.main.currentAuditorId==currentUser.id"
               value="付款通过" class="btn oaBtn btn-sm" @click="applyAudit('4')">
        <input type="button"
               v-if="pageType=='payAudit' && money.main.auditFlag=='3' && money.main.currentAuditorId==currentUser.id"
               value="付款驳回" style="margin-left: 20px;" class="btn oaBtn btn-sm" @click="applyAudit('5')">

        <!--<input type="button" style="margin-left:20px;"-->
        <!--v-if="pageType=='payAudit' && money.main.auditFlag=='3' && money.main.currentAuditorId==currentUser.id"-->
        <!--value="同意付款" class="btn oaBtn btn-sm" @click="payAudit('4')">-->
        <!--<input type="button" style="margin-left:20px;"-->
        <!--v-if="pageType=='payAudit' && money.main.auditFlag=='3' && money.main.currentAuditorId==currentUser.id"-->
        <!--value="驳回付款" class="btn oaBtn btn-sm" @click="payAudit('5')">-->
        <input type="button" style="margin-left:20px;" v-if="showCopierReturn()" value="驳回"
               class="btn oaBtn btn-sm" @click="copierReturn(0,'2')">
        <input type="button" style="margin-left:20px;"
               v-if="pageType=='pay' && money.main.auditFlag=='4'" value="付款"
               class="btn oaBtn btn-sm" @click="payMoney">
        <input type="button" style="margin-left:20px;"
               v-if="pageType=='pay' && money.main.auditFlag=='4'" value="付款人驳回"
               class="btn oaBtn btn-sm" @click="payReturn">
        <!--<input type="button" style="margin-left:20px;" value="返回上一页" class="btn oaBtn btn-sm"-->
        <!--@click="goBack">-->
        <input class="btn oaBtn btn-sm" type="button" style="margin-left:20px;" :value="'打印（'+money.main.printTimes+'次）'" @click="print"
               v-if="money.main.auditFlag !='-1' && money.main.auditFlag != '0' && money.main.auditFlag != '2'">
    </div>
</div>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=63aed32f"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<!--ztree组件所需js-->
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="/dist/js/pages/apply/money/class.js?v1.0"></script>
<script type="text/javascript" src="/dist/js/pages/system/systemService.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/commonService.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/changeMoneyToChinese.js"></script>
<script type="text/javascript" src="/dist/plugins/print/print.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
    $(function () {
        $("body").on("click", ".moreList", function (e) {
            var tableName = $(this).attr("data-table");
            var column = $(this).attr("data-column");
            var columnName = $(this).attr("data-columnName");
            var mainKey = $(this).attr("data-column");
            var mid = $(this).attr("data-mid");
            var type = $(this).attr("data-type");
            if ($(this).hasClass("jiaobiao3")) {
                $.dialog({
                    content: 'url:/page/logs/logs.html?tableName=' + tableName + '&column=' + column + '&columnName=' + columnName + "&mainKey=" + mainKey + "&mid=" + mid + '&type=' + type + '&id=' + app.id,
                    title: '修改日志',
                    width: 600,
                    height: 500,
                    max: false,
                    min: false,
                    lock: true
                });
            }
        });
        $("body").on("click", ".moreListData", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".moreListData").hide();
        });
    });
</script>
<script type="text/javascript">
    var api = frameElement.api, W = api.opener;

    function prints(description) {
        var oldData = description;
        if (description) {
            var temp = app.money.main.description;
            app.money.main.description = description;
            setTimeout(function () {
                $("#app").print({
                    globalStyles: false,
                    mediaPrint: false,
                    stylesheet: "/dist/css/page/print.css?t=" + new Date(),
                    noPrintSelector: ".no-print",
                    iframe: true,
                    append: null,
                    prepend: null,
                    manuallyCopyFormValues: true,
                    deferred: $.Deferred()
                });
                app.money.main.description = temp;
            }, 500);
        }

    }

    function refresh() {

    }

    // 注册一个局自定义指令 `v-inputOnce`
    Vue.directive('onedate', {
        // 当被绑定的元素插入到 DOM 中时……
        update: function (el, binding) {
            // 聚焦元素
            if (app.pageType != 'add') {
                if (el.value == "NaN.undefined" || el.value == "") {
                    el.value = binding.value
                }
            }
        },
        componentUpdated: function (el, binding) {
            // 聚焦元素


        }
    })

    var app = new Vue({
        el: "#app",
        data: {
            isGo:true,//是否可执行ajax
            wyp:false,
            orgNameList: [],
            id: $.wyui.page.urlParams.id,
            isShowAuditReturnBtn: false,
            currentUser: getCurrentUser(),
            pageType: "edit",
            isAdd:$.wyui.page.urlParams.isAdd,
            typeList:[],
            payList: [
                {name: '转账'},
                {name: '现金'},
                {name: '承兑汇票'},
                {name: '冲账'},
                {name: '挂账'}
            ],
            offTheWayList: [
                {name: '现金还款'},
                {name: '发票冲抵'},
                {name: '发票冲抵+现金还款'},
                {name: '无票冲抵'}
            ],
            money: {
                main: new Money.Main(),
                payees: [
                    new Money.Payee()
                ],
                auditors: [
                    new Money.Audit(),
                    new Money.Audit(),
                    new Money.Audit()
                ],
                copiers: [],
                attaches: []//附件
            },
            uploader: null,
            copierSelectedIdx: -1,
            price: 0,
            priceChinese: "",
            historys: [],
            payeePosition: -1 //焦点收款人的position
        },
        methods: {
            getCompanyName: function () {
                console.log("1")
                this.money.main.title = this.money.main.orgName.split('-')[0] + "用款申请";
            },
            cilckInitAutoComplete: function () {
                setTimeout(function () {
                    initAutoComplete();
                }, 300);
            },
            showCopierReturn: function () {
                if (this.money.main.auditFlag != '-1') {
                    var copierIds = new Array();
                    for (var i = 0; i < this.money.copiers.length; i++) {
                        copierIds.push(this.money.copiers[i].copyPersonId);
                    }
                    return $.inArray(currentUser.id, copierIds) > -1;
                }
                return false;
            },
            showAuditReturnBtn: function () {
                if (this.pageType == 'browser' && (this.money.main.auditFlag == '0' || this.money.main.auditFlag == '1' || this.money.main.auditFlag == '3' || this.money.main.auditFlag == '4')) {
                    this.isShowAuditReturnBtn = true
                } else {
                    this.isShowAuditReturnBtn = false
                }
            },
            fjStyle: function (fjName) {
                if (fjName) {
                    var type = fjName.substring(fjName.lastIndexOf('.') + 1);
                    return 'img fj-' + type
                }
                return 'img'
            },
            copierReturn: function (type,auditFlag) {
                //type : 0-抄送人驳回  1-审核人驳回
                $.dialog({
                    content: 'url:copierReturnReason.html?id=' + this.money.main.id + "&t=" + new Date() + "&type=" + type + "&auditFlag=" + auditFlag,
                    title: '驳回',
                    width: 300,
                    height: 250,
                    max: false,
                    min: false,
                    lock: true
                });
            },
            payReturn: function () {
                $.dialog({
                    content: 'url:payReturnReason.html?id=' + this.money.main.id + "&t=" + new Date(),
                    title: '填写驳回原因',
                    width: 300,
                    height: 200,
                    max: false,
                    min: false,
                    lock: true
                });
            },
            print: function () {
                var oldData = this.money.main.description;
//               var htl = ""
//               html = '<textarea style="width:95%;margin: 0 auto;outline: none;resize: none;" rows="10" cols="30" id="printText" class="printInput"></textarea><input class="btn oaBtn btn-sm printBtn" type="button" value="确认打印" onclick="app.printOk()">';
                $.dialog({
                    content: 'url:/page/apply/money/print.html?id=' + this.id ,
                    title: '请填写用款事由(打印)',
                    width: 350,
                    max: false,
                    min: false,
                    lock: true
                });
//                $("#printText").text(oldData);
            },
            convertToChinese: function (item) {
                item.payeeMoneyChinese = changeMoneyToChinese(item.payeeMoney);
                this.allPrice();

            },
//            printOk: function () {
//                var that = this;
//                var oldData = this.money.main.description;
//                if ($(".printInput").val()) {
//                    this.money.main.description = $(".printInput").val();
//                    setTimeout(function () {
//                        $("#app").print({
//                            globalStyles: false,
//                            mediaPrint: false,
//                            stylesheet: "/dist/css/page/print.css?t=" + new Date(),
//                            noPrintSelector: ".no-print",
//                            iframe: true,
//                            append: null,
//                            prepend: null,
//                            manuallyCopyFormValues: true,
//                            deferred: $.Deferred()
//                        });
//                        that.money.main.description = oldData;
//                    }, 500);
//                } else {
//                    alert("请填写用款事由（打印）")
//                }
//
//            },
            payMoney: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.apply.money.payMoney, {
                    id: $.wyui.page.urlParams.id,
                    payUserId: this.currentUser.id,
                    payRemark: this.money.main.payRemark,
                    payUserName: this.currentUser.name
                }, function () {
                    if (that.money.main.type == "薪资/奖金" && that.money.attaches[0] && server.fwq != 'wyp') {
                        if (that.money.attaches[0].name.indexOf("工资")) {
                            console.log("111")
                            setTimeout(function () {
                                App.blockUI({
                                    target: '#app',
                                    boxed: true,
                                    message: '加载中......'//,
                                    // animate: true
                                });
                            }, 200)

                            $.wyui.postMethod("/salaryDetails/senderSalary.json", {
                                    attachName: that.money.attaches[0].name
                                }, function () {
                                    App.unblockUI('#app');
                                    alert("付款成功");
                                    parent.refresh();
                                    api.close();

                                }
                            )

                        } else {
                            alert("付款成功");
                            parent.refresh();
                            api.close();
                        }
                    } else {
                        alert("付款成功");
                        parent.refresh();
                        api.close();
                    }

                });
            },
            convertAuditFlagToName: function (auditFlag) {
                //auditFlag:-1,0,1,2,3,4,5,6
                switch (auditFlag) {
                    case "-1":
                        return "未提交";
                        break;
                    case "0":
                        return "待审核";
                        break;
                    case "1":
                        return "通过";
                        break;
                    case "2":
                        return "驳回";
                        break;
                    case -1:
                        return "未提交";
                        break;
                    case 3:
                        return "待审核";
                        break;
                    case 4:
                        return "通过";
                        break;
                    case 5:
                        return "驳回";
                        break;
                    default :
                        break;
                }
            },
            fmoney: function (s, n) {
                if (s != '') {
                    n = n > 0 && n <= 20 ? n : 2;
                    s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                    var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                        t = "";
                    for (i = 0; i < l.length; i++) {
                        t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                    }
                    return t.split("").reverse().join("") + "." + r;
                } else {
                    return '';
                }
            },
            strFormatF: function (target, data) {
                var value = '';
                var dataList = data.split('.');

                if (dataList.length > 0) {
                    if (dataList.length == 1) {
                        value = this[dataList[0]]
                    }
                    if (dataList.length == 2) {
                        value = this[dataList[0]][dataList[1]]
                    }
                    if (dataList.length == 3) {
                        value = this[dataList[0]][dataList[1]][dataList[2]]
                    }
                    if (dataList.length == 4) {
                        value = this[dataList[0]][dataList[1]][dataList[2]][dataList[3]]
                    }
                    if (dataList.length == 5) {
                        value = this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]]
                    }
                }
                if (!value || value == '0.00') {
                    console.log('获取焦点', value)
                    value = '';
                }
                target.value = value;
            },
            strFormat: function (target, data) {
                //此结果为了展示数据
                var value = (target.value).trim();
                value = value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g, '');
                if (!value) {
                    value = 0
                }
                ;
                //此结果为data存入数据
                var dataList = data.split('.');

                if (dataList.length > 0) {
                    if (dataList.length == 1) {
                        this[dataList[0]] = value;
                    }
                    if (dataList.length == 2) {
                        this[dataList[0]][dataList[1]] = value;
                    }
                    if (dataList.length == 3) {
                        this[dataList[0]][dataList[1]][dataList[2]] = value;
                    }
                    if (dataList.length == 4) {
                        this[dataList[0]][dataList[1]][dataList[2]][dataList[3]] = value;
                    }
                    if (dataList.length == 5) {
                        this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]] = value;
                    }
                }
                target.value = this.fmoney(value);
            },
            addItem: function (prop, className) {
                this.money[prop].push(new Money[className]());
                if (className == 'Payee') {
                    setTimeout(function () {
                        initUserComplete();
                    }, 300);
                } else {
                    setTimeout(function () {
                        initAutoComplete();
                    }, 300);
                }
            },
            delItem: function (prop, i, desc) {
                if (this.money[prop].length <= 1) {
                    alert("请至少保留一位审核人！")
                    return
                }
                this.money[prop].splice(i, 1);
            },
            save: function (auditFlag) {
                var that = this;
                if (this.money.main.type == "") {
                    alert("请选择款项用途");
                    return;
                }
                if (auditFlag == "0") {
                    if (this.money.main.description == "") {
                        alert("请填写用款事由");
                        return;
                    }
                    if (this.money.main.haveRefund == "1") {

                        if (this.money.main.estimatedReturnDate == '') {
                            alert("请填写预计退款日期");
                            return;
                        }
                        if (this.money.main.estimatedReturnMoney == '') {
                            alert("请填写预计退款金额");
                            return;
                        }
                    }
                }
                this.money.main.auditFlag = auditFlag;
                if (parseInt($.wyui.page.urlParams.isAdd) == 1) {
                    this.money.main.id = '';
                }
                if (this.money.main.haveRefund == '1') {
                    this.money.main.haveRefund = 1;
                    this.money.main.returnPayeeId = getCurrentUser().id;
                    this.money.main.returnPayeeName = getCurrentUser().name;
                    this.money.main.returnPayeeRoleName = getCurrentUser().roleName;
                } else {
                    this.money.main.haveRefund = 0;
                    this.money.main.haveReturnClear = 0;
                }
                this.money.main.updateUserId = getCurrentUser().id;
                if (this.pageType == 'edit' && this.money.main.payReturnReasonType == '其他原因') {
                    if (auditFlag == '0') {
                        this.money.main.auditFlag = '4';
                    }
                }
                for (var i = 0; i < this.money.auditors.length; i++){
                    if (this.money.auditors[i].auditorId == "2017121618514C22B68296F31AF8DDE2") {
                        alert("请去除审核人中的谈小中");
                        return;
                    }
                    if(server.fwq != 'wyp' && this.money.auditors[i].auditorId == '201712171253420DBBFAE64C57F955B9'){
                        alert("请去除审核人中的邓继英");
                        return;
                    }
                }
                for (var i = 0; i < this.money.auditors.length; i++){
                    if (server.fwq != 'wyp' && this.money.auditors[this.money.auditors.length-1].auditorId != "201712171257484DA20FEC7F96A76B3D") {
                        alert("请填写靳悦双为最后一个审核人");
                        return;
                    }
                }
                var isTan = false;
                var isDeng = false;
                for(var i=0;i<this.money.copiers.length;i++){
                    if(this.money.copiers[i].copyPersonName == '谈小中'){
                       isTan = true;
                    }
                    if(server.fwq != 'wyp' && this.money.copiers[i].copyPersonName == '邓继英'){
                        isDeng = true;
                    }
                }
                if(!isTan){
                    alert("请填写谈小中为抄送人")
                    return false;
                }
                if(isDeng){
                    alert("请去除抄送人中的邓继英")
                    return false;
                }
                if(that.isGo){
                    that.isGo=false;
                    $.wyui.postLoadMethod(urlConfig.apply.money.save, trimRN(this.money), function (data) {
//                        alert("操作成功");
                        that.isGo=true;
                        parent.refresh();
//                    var $iframe = top.findIframeByName("用款申请");
//                    $iframe[0].contentWindow.refresh();
                        setTimeout(function () {
                            api.close();
                        }, 1000);
                        that.showModel(200, "操作成功")
                    },false,true);
                }

            },
            //提示弹框
            showModel: function (width, title) {
                parent.$.alert({type:'topAlert',width:width,title:title})
            },
            savePayAuditors:function (auditFlag) {
                var that = this;
                var auditListNew =[]
                for( var i = 0;i <=that.money.auditList.length;i++){
                    if( that.money.auditList[i] ){
                        if(!that.money.auditList[i].auditorId ){
                            alert("请填写付款审核人");
                            return;
                        } else{
                            auditListNew.push(that.money.auditList[i])
                        }
                    }
                }
                that.money.auditList = auditListNew

                that.money.main.auditFlag = auditFlag;
                that.money.main.id = that.id;
                that.money.main.updateUserId = currentUser.id;
                delete that.money.main.createTime;
                $.wyui.postMethod(urlConfig.apply.money.savePayAuditors, trimRN(that.money), function (data) {
                    alert("操作成功");
                    parent.refresh();
//                    var $iframe = top.findIframeByName("用款申请");
//                    $iframe[0].contentWindow.refresh();
                    api.close();
                });
            },
            //小魏你好：沃源新OA有个付款驳回，里面有两个选项，一个是金额，一个是其它，选其它驳回一般都是卡号或者开户行错了，这个能否驳回后，申请人修改后直接提到待付款这，现在付款驳回要重新全部审批。
            payReturnStatus: function () {
                var that = this;
                if (that.pageType == 'edit' && that.money.main.payReturnReasonType == '其他原因') {
                    return false;
                } else {
                    return true;
                }
            },
            applyAudit: function (auditFlag) {
                var that = this;
                if (auditFlag == '1' || auditFlag == '4') {
                    top.$.alert({
                        win: this,
                        height: 180,
                        width: 300,
                        icon: '3', //1成功 2失败 3提示 不传代表无图标
                        title: '确定要通过吗？',

                        blankclose: true,//点击空白是否可关闭
                        ok: "通过",//是否显示确认按钮,
                        okCallback: function (em, opts) {
                            //确认按钮回调
                            em.remove()
                            opts.close && opts.close()
                            advise = '同意！';
                            $.wyui.postLoadMethod(urlConfig.apply.money.applyAudit,{
                                id: that.money.main.id,
                                userId: getCurrentUser().id,
                                auditFlag: auditFlag,
                                advise: advise
                            }, function (r) {
                                if (parent.app) {
                                    parent.refresh();
                                }
                                setTimeout(function () {
                                    api.close();
                                }, 1000);
                                that.showModel(200, "审核成功")
                            }, false, true)
                        },
                        cancel: "取消",
                        cancelCallback: function (em, opts) {
                            em.remove()
                            opts.close && opts.close()
                        }
                    })
                } else if (auditFlag == '2') {
                    this.copierReturn(1,'2')
                    return;
                } else if (auditFlag == '5') {
                    this.copierReturn(1,'5')
                    return;
                }
            },
            payAudit: function (auditFlag) {
                $.wyui.postLoadMethod(urlConfig.apply.money.payAudit, {
                    ids: $.wyui.page.urlParams.id,
                    userId: getCurrentUser().id,
                    auditFlag: auditFlag
                }, function () {
                    alert("审核成功");
                    if (parent.app) {
                        parent.refresh();
                    }
//                    var $iframe = top.findIframeByName("用款申请");
//                    $iframe[0].contentWindow.refresh();
                    api.close();
                },false,true);
            },
            goBack: function () {
                api.close();
            },
            showDatePicker: function (e, item) {
                WdatePicker({
                    onpicked: function (dp) {
                        item.offTime = dp.cal.getNewDateStr();
                        return true;
                    }
                });
                $(e.target).blur();
            },
            showDatePicker2: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.money.main.estimatedReturnDate = dp.cal.getNewDateStr();
                        return true;
                    }
                });
                $(e.target).blur();
            },
            inputFocus: function (id) {
                $("#" + id).focus();
            },
            selectUser: function (i, prop) {
                this.copierSelectedIdx = -1;
                this[prop] = i;
            },
            unselectUser: function () {
                this.copierSelectedIdx = -1;
            },
            deleteUser: function (event) {
                if (event.keyCode == 46 || event.keyCode == 8 && event.target.value == "") {
                    if (this.copierSelectedIdx > -1) {
                        this.money.copiers.splice(this.copierSelectedIdx, 1);
                        this.copierSelectedIdx = -1;
                    } else {
                        this.copierSelectedIdx = this.money.copiers.length - 1;
                    }
                }
            },
            deleteFile: function (i) {
                if (window.confirm("确定要删除该附件吗?")) {
                    this.money.attaches.splice(i, 1);
                }
            },
            download: function (attachId, fileName) {
                downloadFile(attachId, fileName)
                return false;
            }, allPrice: function () {
                var that = this;
                var num = 0;
                console.log(that.money.payees)
                for (var i = 0; i < that.money.payees.length; i++) {
                    num += parseFloat(that.money.payees[i].payeeMoney);
                }
                if (!num) {
                    num = 0
                }
                ;
                that.price = num.toFixed(2);
                that.priceChinese = changeMoneyToChinese(num.toFixed(2));
            },
            //获取日志
            getMoreHistory: function () {
                var that = this;
                $(".moreList").each(function () {
                    console.log($(this));
                    var demo = $(this);
                    var tableName = $(this).attr("data-table");
                    var type = $(this).attr("data-type");
                    if (type == '1') {
                        var columnName = $(this).attr("data-column");
                        $.wyui.postMethod(urlConfig.logs.getColumnLogsNum, {
                            "tableName": tableName,
                            "columnName": columnName,
                            "updateId": that.id
                        }, function (data) {
                            console.log(data)
                            if (data.result) {
                                var p = new Array();
                                p.push("<i></i>");
                                demo.addClass("jiaobiao3");
                                demo.append(p.join(""))
                            }
                        })
                    } else if (type == "2") {
                        var columnName = $(this).attr("data-columnName");
                        var mainKey = $(this).attr("data-column");
                        var mid = $(this).attr("data-mid");
                        $.wyui.postMethod(urlConfig.logs.getTableLogsNum, {
                            "tableName": tableName,
                            "columnName": columnName,
                            "mainKey": mainKey,
                            "id": mid
                        }, function (data) {
                            console.log(data)
                            if (data.result) {
                                var p = new Array();
                                p.push("<i></i>");
                                demo.addClass("jiaobiao3");
                                demo.append(p.join(""))
                            }
                        })
                    }
                })
            },
            smallTypeChange: function () {
                var that = this;
                console.log(that.money.main.type);
                if (that.money.main.type == "薪资/奖金") {
                    that.uploader.stop();
                    that.uploader.options.server = server.ip + '/importExcel/salaryFile.json'//你想要更改的地址
                    that.uploader.upload()
                    $(".webuploader-pick").text("导入工资")
                } else {
                    that.uploader.stop();
                    that.uploader.options.server = server.ip + '/attach/uploadFile.json'//你想要更改的地址
                    that.uploader.upload()
                    $(".webuploader-pick").text("添加附件")
                }

                $.wyui.postMethod("/auditAndCopier/getAuditAndCopierService.json", {
                    companyId: getCurrentUser().companyId,
                    userId: getCurrentUser().id,
                    smallType: that.money.main.type,
                    bigType: 'moneyApply'
                }, function (data) {
                    that.money.copiers = [];
                    that.money.auditors = [];
                    if (data && data.copier && data.copier.length > 0) {
                        for (var i = 0; i < data.copier.length; i++) {
                            var a = {
                                copyPersonId: data.copier[i].id,
                                copyPersonName: data.copier[i].name
                            };
                            that.money.copiers.push(a);
                        }
                    }
                    if (data && data.audit && data.audit.length > 0) {
                        for (var i = 0; i < data.audit.length; i++) {
                            var a = {
                                auditorId: data.audit[i].id,
                                auditFlag: data.audit[i].auditFlag,
                                auditorName: data.audit[i].name + "-" + data.audit[i].roleName
                            };
                            that.money.auditors.push(a);
                        }
                    }
                    if (that.money.auditors.length == 0) {
                        $.wyui.postMethod(urlConfig.system.user.getFirstParent, {userId: getCurrentUser().id}, function (data) {
                            app.money.auditors.push(new Money.Audit());
                            app.money.auditors[0].auditorId = data.id;
                            app.money.auditors[0].auditorName = data.name + "-" + data.roleName;
                        });
                    }
                    setTimeout(function () {
                        initAutoComplete();
                    }, 300);
                });
            },
            payeeFocus: function (i) {
                this.payeePosition = i
                console.log("焦点:收款人:" + this.payeePosition)
            }
        },

        mounted: function () {
            if(server.fwq){
                if(server.fwq=="wyp"){
                    this.wyp=true;
                }
            }
            //页面操作状态
            this.pageType = $.wyui.page.urlParams.pageType;
            //上传附件
            var that = this;

            if (that.pageType == 'edit') {
                $.wyui.postMethod(urlConfig.system.user.getAllByUserId, {
                    'userId': getCurrentUser().id,
                }, function (data) {
                    that.orgNameList = data.result;
                    if (that.orgNameList) {
                        that.money.main.orgName = that.orgNameList[0].companyName + '-' + that.orgNameList[0].departName;
                        that.money.main.title = that.orgNameList[0].companyName + "用款申请";
                    }
                })
            }
            $.wyui.postMethod("/aplType/getNameList.json", {modelName:'money'},function (data) {
                that.typeList=data.names;
                console.log(that.typeList);
            });

            this.uploader = WebUploader.create({
                // 选完文件后，是否自动上传。
                auto: true,
                // swf文件路径
                swf: "/statics/plugin/webuploader-0.1.5/Uploader.swf",
                // 文件接收服务端。
                server: server.fjIp + "/attach/uploadFile.json",
                // 选择文件的按钮。可选。
                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                pick: '#divUpload',
                duplicate: true
            });
            this.uploader.on("uploadStart", function () {
                $(".oaLoad").show();
            });
            this.uploader.on("uploadComplete", function () {
                $(".oaLoad").hide()
            });
            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
            this.uploader.on('uploadSuccess', function (file, response) {
                if (response._raw == "文件上传出错！") {
                    alert("文件上传出错！请把EXCEL例子删除！");
                } else {
                    that.money.attaches.push({
                        id: response.id,
                        name: response.name,
                        url: response.url
                    });
                }
            });
            // 文件上传失败，显示上传出错。
            this.uploader.on('uploadError', function (file) {
                alert("上传失败！");
                $(".oaLoad").hide()
            });

            //编辑
            if (parseInt($.wyui.page.urlParams.id) > 0) {
                $.wyui.postMethod(urlConfig.apply.money.getById, {id: $.wyui.page.urlParams.id}, function (data) {
                    var params = {moduleId: data.main.id};
                    that.historys = data.historys;
                    commonService.getAttachesByModuleId(params, function (attaches) {
                        if (attaches) {
                            data.attaches = attaches;
                        }
                        if (!data.main.printTimes) {
                            data.main.printTimes = 0;
                        }

                        console.log("次数")
                        console.log(data);
                        if(data.main.auditFlag == '1' && that.pageType == 'waitPay'){
                            data.auditList = [
                                new Money.PayAudit(),
                                new Money.PayAudit(),
                                new Money.PayAudit()
                            ];
                        }
                        that.money = data;
                        setTimeout(function () {
                            initAutoComplete();
                        }, 300);
                        if (that.money.main.type == "薪资/奖金") {
                            that.uploader.stop();
                            that.uploader.options.server = server.ip + '/importExcel/salaryFile.json'//你想要更改的地址
                            that.uploader.upload()
                            $(".webuploader-pick").text("导入工资")
                        } else {
                            that.uploader.stop();
                            that.uploader.options.server = server.ip + '/attach/uploadFile.json'//你想要更改的地址
                            that.uploader.upload()
                            $(".webuploader-pick").text("添加附件")
                        }
                        //如果当前用户是审核人之一
                        for (var i = 0; i < that.money.auditors.length; i++) {
                            if (that.money.auditors[i].auditorId == getCurrentUser().id) {
                                that.showAuditReturnBtn()
                            }
                        }
                        if (that.money.payees.length > 0) {
                            for (var i = 0; i < that.money.payees.length; i++) {
                                that.money.payees[i].payeeMoneyChinese = changeMoneyToChinese(that.money.payees[i].payeeMoney)
                            }
                        }
                        that.allPrice();
                    });
                });
            };
            if (this.pageType != 'edit') {
                setTimeout(function () {  //使用  setTimeout（）方法设定定时2000毫秒
                    that.getMoreHistory();
                }, 600);
            }
            console.log(this.money);
        }

    });
</script>
<script>
    $(function () {
        initAutoComplete();
        initUserComplete();
    });

    function initAutoComplete() {
        $(".payAuditorName,.auditorName,.copier,.returnPayee").autoComplete({
            url: server.ip + urlConfig.system.user.getTop10ByNameUser,
            render: function (users, panel) {
                for (var i = 0; i < users.length; i++) {
                    $("<li></li>").data("autoComplete",
                        users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                        "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                        .appendTo(panel);
                }
            },
            selected: function (user) {
                if ($(this).hasClass("auditorName")) {
                    var idx = $(this).attr("idx");
                    app.money.auditors[idx].auditorId = user.id;
                    app.money.auditors[idx].auditorName = user.name + "-" + user.roleName;
                }else if ($(this).hasClass("payAuditorName")) {
                    var idx = $(this).attr("idx");
                    app.money.auditList[idx].auditorId = user.id;
                    app.money.auditList[idx].auditorName = user.roleName + "-" + user.name;
                }
                else if ($(this).hasClass("copier")) {
                    var userIds = new Array();
                    for (var i = 0; i < app.money.auditors.length; i++) {
                        userIds.push(app.money.auditors[i].auditorId);
                    }
                    for (var i = 0; i < app.money.copiers.length; i++) {
                        userIds.push(app.money.copiers[i].copyPersonId);
                    }
                    if ($.inArray(user.id, userIds) == -1) {
                        app.money.copiers.push({copyPersonId: user.id, copyPersonName: user.name});
                    } else {
                        alert("审核人、抄送人不能重复输入");
                    }
                    $(this).val("");
                } else if ($(this).hasClass("returnPayee")) {
                    app.money.main.returnPayeeId = user.id;
                    app.money.main.returnPayeeName = user.name;
                    app.money.main.returnPayeeRoleName = user.roleName;
                }
                return false;
            },
            height: 210,
            width: 300
        });
    }

    function initUserComplete() {
        $(".payeeName").autoComplete({
            url: server.ip + urlConfig.apply.money.getPayeeList,
            render: function (users, panel) {
                if (users) {
                    for (var i = 0; i < users.length; i++) {
                        $("<li></li>").data("autoComplete",
                            users[i]).html("<a>" + users[i].payeeName + "&nbsp;&nbsp;&nbsp;" +
                            "(" + "&nbsp;" + users[i].bankName + ") " + "</a>")
                            .appendTo(panel);
                    }
                }
            },
            selected: function (user) {
                console.log(app.money.payees)
                var payee = {
                    id: user.id,
                    payeeName: user.payeeName,
                    bankName: user.bankName,
                    bankCardNumber: user.bankCardNumber
                }
                app.money.payees.splice(app.payeePosition, 1, payee)
                // app.money.main.payeeId = user.id;
                // app.money.main.payeeName = user.payeeName;
                // app.money.main.bankName = user.bankName;
                // app.money.main.bankCardNumber = user.bankCardNumber;
                return false;
            },
            extraParams: {userId: getCurrentUser().id},
            height: 210,
            width: 300
        });
    }


    //    function printOk() {
    //
    //    }
</script>
</body>
</html>